package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "approval_", schema = "crm")
/** 审批*/
public class Approval {
    private int approvalId;
    private String approvalTheme;// 审批主题
    private String approvalContent;// 审批内容
    private String approvalStay;// 待审批人
    private Integer approvalStatus;// 审批状态
    private Date approvalDate;// 创建日期
    private Integer approvalClassify;// 类别 报价？出差？合同？
    private String approvalOperation;// 审批操作
    private Timestamp approvalTime;// 创建时间
    private Businesstrip businesstripByBusinessId;
    private Purchase purchaseByPurchaseId;
    private PaymentPlan paymentPlanByPaymentPlanId;
    private Quotation quotationByQuotationId;
    private Contract contractByContractId;
    private Employee employeeByApplicantEmpId;// 申请人
    private Employee employeeByApprovalEmpId;// 审批人

    @Id
    @Column(name = "approval_id", nullable = false)
    public int getApprovalId() {
        return approvalId;
    }

    public void setApprovalId(int approvalId) {
        this.approvalId = approvalId;
    }


    @Basic
    @Column(name = "approval_theme", nullable = true, length = 255)
    public String getApprovalTheme() {
        return approvalTheme;
    }

    public void setApprovalTheme(String approvalTheme) {
        this.approvalTheme = approvalTheme;
    }

    @Basic
    @Column(name = "approval_content", nullable = true, length = 255)
    public String getApprovalContent() {
        return approvalContent;
    }

    public void setApprovalContent(String approvalContent) {
        this.approvalContent = approvalContent;
    }


    @Basic
    @Column(name = "approval_stay", nullable = true, length = 255)
    public String getApprovalStay() {
        return approvalStay;
    }

    public void setApprovalStay(String approvalStay) {
        this.approvalStay = approvalStay;
    }

    @Basic
    @Column(name = "approval_status", nullable = true)
    public Integer getApprovalStatus() {
        return approvalStatus;
    }

    public void setApprovalStatus(Integer approvalStatus) {
        this.approvalStatus = approvalStatus;
    }

    @Basic
    @Column(name = "approval_date", nullable = true)
    public Date getApprovalDate() {
        return approvalDate;
    }

    public void setApprovalDate(Date approvalDate) {
        this.approvalDate = approvalDate;
    }

    @Basic
    @Column(name = "approval_classify", nullable = true)
    public Integer getApprovalClassify() {
        return approvalClassify;
    }

    public void setApprovalClassify(Integer approvalClassify) {
        this.approvalClassify = approvalClassify;
    }

    @Basic
    @Column(name = "approval_operation", nullable = true, length = 255)
    public String getApprovalOperation() {
        return approvalOperation;
    }

    public void setApprovalOperation(String approvalOperation) {
        this.approvalOperation = approvalOperation;
    }


    @Basic
    @Column(name = "approval_time", nullable = true, length = 255)
    public Timestamp getApprovalTime() {
        return approvalTime;
    }

    public void setApprovalTime(Timestamp approvalTime) {
        this.approvalTime = approvalTime;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Approval approval = (Approval) o;
        return approvalId == approval.approvalId &&
                Objects.equals(approvalTheme, approval.approvalTheme) &&
                Objects.equals(approvalContent, approval.approvalContent) &&
                Objects.equals(approvalStay, approval.approvalStay) &&
                Objects.equals(approvalStatus, approval.approvalStatus) &&
                Objects.equals(approvalDate, approval.approvalDate) &&
                Objects.equals(approvalClassify, approval.approvalClassify) &&
                Objects.equals(approvalOperation, approval.approvalOperation);
    }

    @Override
    public int hashCode() {
        return Objects.hash(approvalId,approvalTheme,approvalContent ,approvalStay, approvalStatus, approvalDate, approvalClassify, approvalOperation);
    }

    @ManyToOne
    @JoinColumn(name = "business_id", referencedColumnName = "business_id")
    public Businesstrip getBusinesstripByBusinessId() {
        return businesstripByBusinessId;
    }

    public void setBusinesstripByBusinessId(Businesstrip businesstripByBusinessId) {
        this.businesstripByBusinessId = businesstripByBusinessId;
    }

    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseByPurchaseId() {
        return purchaseByPurchaseId;
    }

    public void setPurchaseByPurchaseId(Purchase purchaseByPurchaseId) {
        this.purchaseByPurchaseId = purchaseByPurchaseId;
    }

    @ManyToOne
    @JoinColumn(name = "payment_plan_id", referencedColumnName = "payment_plan_id")
    public PaymentPlan getPaymentPlanByPaymentPlanId() {
        return paymentPlanByPaymentPlanId;
    }

    public void setPaymentPlanByPaymentPlanId(PaymentPlan paymentPlanByPaymentPlanId) {
        this.paymentPlanByPaymentPlanId = paymentPlanByPaymentPlanId;
    }


    @ManyToOne
    @JoinColumn(name = "quotation_id", referencedColumnName = "quotation_id")
    public Quotation getQuotationByQuotationId() {
        return quotationByQuotationId;
    }

    public void setQuotationByQuotationId(Quotation quotationByQuotationId) {
        this.quotationByQuotationId = quotationByQuotationId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }

    @ManyToOne
    @JoinColumn(name = "applicant_emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByApplicantEmpId() {
        return employeeByApplicantEmpId;
    }

    public void setEmployeeByApplicantEmpId(Employee employeeByApplicantEmpId) {
        this.employeeByApplicantEmpId = employeeByApplicantEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "approval_emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByApprovalEmpId() {
        return employeeByApprovalEmpId;
    }

    public void setEmployeeByApprovalEmpId(Employee employeeByApprovalEmpId) {
        this.employeeByApprovalEmpId = employeeByApprovalEmpId;
    }

}
